using UnityEngine;
using System.Collections;

/// \class  gkUtilityComponent
/// \brief  Component utility function
public class gkUtilityComponent 
{	
	/// \brief  Try to grab a component by game object name
	public static TComponentType TryGrabComponentByGameObjectName<TComponentType>(string a_rComponentGameObjectName) where TComponentType : Component
	{
		GameObject rGameObject;
		
		// try to grab the named swarm
		rGameObject = GameObject.Find(a_rComponentGameObjectName);
		if(rGameObject != null)
		{
			return rGameObject.GetComponent<TComponentType>();
		}
		return null;
	}
}
